﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Common;
using System.Data;
using System.Data.SqlClient;
using System.Reflection;
using System.Resources;
using System.ComponentModel;
using System.IO;
using System.Configuration;

namespace Dal
{
    public class ClassificationDao
    {
        public static DataSet getClassificationReport(string country, string ambiente)
        {
            string cnx = Credentials.getCredentias(ambiente);
            if (cnx == null) return null;
            SqlCommand cmd = new SqlCommand();
            cmd.Connection = new SqlConnection(cnx);
            cmd.CommandType = System.Data.CommandType.StoredProcedure;
            cmd.CommandText = "dms_Report_Classification";
            cmd.Parameters.AddWithValue("@Country", country);
            cmd.CommandTimeout = 0;

            SqlDataAdapter da = new SqlDataAdapter(cmd);
            DataTable dt = new DataTable("Classificationdt");

            try
            {

                cmd.Connection.Open();
                da.Fill(dt);
                cmd.Connection.Close();
            }
            catch (Exception ex)
            {
                Credentials.writeLogFile("getClassificationReport: " + ex.Message);
                return null;
            }

            DataSet ds = new DataSet("Classificationds");
            ds.Tables.Add(dt);
            cmd.Connection.Close();
            return ds;
        }

    }
}
